<?php

namespace App\Clients\Keruyun;

use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Database\Eloquent\Model;

class StoreQueryOrgTree extends KeruyunClient
{
    public function __construct(Model $account){
        parent::__construct($account);
        $this->queryData = [
            'group' => 'HSF',
            '@class' => 'com.alsc.saas.gw.client.HsfReq',
            'service' => 'com.alsc.saas.uac.client.login.WebLoginService',
            'method' => 'queryOrgTree',
            'version' => '1.0.0',
            'eagleEyeUserData' => new \stdClass(),
            'argTypes' => [
                'com.alsc.saas.uac.client.login.request.WebQueryOrgTreeRequest'
            ],
            'argValues' => [
                new \stdClass()
            ],
            'targetClusterName' => 'alibaba-prod',
            'timeout' => 'PT30S',
            'context' => [
                'visitedDevice' => 'WEB'
            ]
        ];
    }


    /**
     * @throws GuzzleException
     */
    public function execute($queryData = []): StoreQueryOrgTree
    {
        return $this->post("https://saas.keruyun.com/saas-gw/secure/v2/req?hsfApi=queryOrgTree",$queryData);
    }
}
